﻿using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.PB;
using Coldairarrow.Entity.TD;
using Coldairarrow.IBusiness.DTO;
using Coldairarrow.Util;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Business.TD
{
    public partial interface ITD_AllocateBusiness
    {
        Task<PageResult<TD_Allocate>> GetDataListAsync(PageInput<ConditionDTO> input);
        Task<TD_AllocateViewDTO> GetTheDataAsync(string id);
        Task AddDataAsync(TD_Allocate data);
        Task UpdateDataAsync(TD_Allocate data);
        Task DeleteDataAsync(List<string> ids);

        /// <summary>
        /// 调拨出入库列表信息
        /// </summary>
        /// <param name="cateqrcode">调拨单的二维码</param>
        /// <param name="status">出入库状态</param>
        /// <returns></returns>
        Task<List<AllocatePackDetailDTO>> GetAllocatePackListDataAsync(string cateqrcode, int status);

        /// <summary>
        /// 调拨出入库获取包的信息
        /// </summary>
        /// <param name="PackQrCode">包二维码</param>
        /// <param name="cateqrcode">调拨单的二维码</param>
        /// <param name="status">出入库状态</param>
        /// <returns></returns>
        Task<AllocatePackDTO> GetAllocatePackDataAsync(string PackQrCode, string cateqrcode, int status);

        /// <summary>
        /// 调拨出库
        /// </summary>
        /// <param name="data"></param>
        /// 增加混合包和单个物料调拨  2022-02-23  赵锦涛
        /// <returns></returns>
        Task UpcateOutStorageAsync(AllocateDTO data);

        /// <summary>
        /// 调拨出库获取单个成品物料信息
        /// </summary>
        /// <param name="JobQrCode">成品二维码</param>
        /// <param name="cateqrcode">调拨单二维码</param>
        /// <returns></returns>
        Task<AllocateJobMaterialDTO> GetAllocateJobMaterialDataAsync(string JobQrCode, string cateqrcode);

        /// <summary>
        /// 调拨出入库单个物料
        /// </summary>
        /// <param name="data"></param>
        /// 2022-02-23   赵锦涛
        /// <returns></returns>
        Task<AllocateMaterialDTO> GetAllocateDetailMaterialAsync(AllocateDTO data);

        /// <summary>
        /// 调拨单出库移除
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task DeleteAllocateDetailAsync(AllocatePackDetailDTO data);

        /// <summary>
        /// 调拨出库提交
        /// </summary>
        /// <param name="cateqrcode">调拨单的二维码</param>
        /// <returns></returns>
        Task SubmitcateOutStorageAsync(string cateqrcode);

        /// <summary>
        /// 打印调拨单
        /// </summary>
        /// <param name="ParentId"></param>
        /// <returns></returns>
        Task<TD_AllocateListInfo> GetAllocateListInfoPrint(string ParentId);

        /// <summary>
        /// 调拨入库
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task UpcateInStorageAsync(AllocateDTO data);

        /// <summary>
        /// 调拨入库获取单个成品物料信息
        /// </summary>
        /// <param name="JobQrCode">成品二维码</param>
        /// <param name="cateqrcode">调拨单二维码</param>
        /// <returns></returns>
        Task<AllocateJobMaterialDTO> GetInAllocateJobMaterialDataAsync(string JobQrCode, string cateqrcode);

        /// <summary>
        /// 调拨单入库移除
        /// </summary>
        /// <param name="data"></param>
        /// <returns></returns>
        Task DeleteAllocateWarehousingAsync(AllocatePackDetailDTO data);

        /// <summary>
        /// 调拨入库提交
        /// </summary>
        /// <param name="cateqrcode">调拨单的二维码</param>
        /// <returns></returns>
        Task SubmitcateInStorageAsync(string cateqrcode);

        /// <summary>
        /// 获取调拨入库的仓库货位
        /// </summary>
        /// <param name="storId">仓库id</param>
        /// <param name="locationqrcode">货位二维码</param>
        /// <returns></returns>
        Task<PB_Location> GetLocation(string storId, string locationqrcode);
    }

    /// <summary>
    /// 调拨单出库时传值
    /// </summary>
    public class AllocateDTO
    {
        /// <summary>
        /// 调拨单二维码
        /// </summary>
        public string cateqrcode { get; set; }

        /// <summary>
        /// 包/物料二维码
        /// </summary>
        public string packqrcode { get; set; }

        /// <summary>
        /// 成品二维码
        /// </summary>
        public string JobQrCode { get; set; }

        /// <summary>
        /// 货位信息
        /// </summary>
        public string locaqrcode { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public double? Nums { get; set; }

        /// <summary>
        /// 出入状态：0-出库；1-入库
        /// </summary>
        public int? Status { get; set; }
    }

    /// <summary>
    /// 查看调拨出入库明细
    /// </summary>
    public class AllocatePackDetailDTO
    {
        /// <summary>
        /// Id
        /// </summary>
        public string Id { get; set; }

        /// <summary>
        /// 调拨单Id
        /// </summary>
        public string AllocateId { get; set; }

        /// <summary>
        /// 包Id
        /// </summary>
        public string PackId { get; set; }

        /// <summary>
        /// 物料Id
        /// </summary>
        public string MaterialId { get; set; }

        /// <summary>
        /// 成品ID
        /// </summary>
        public string JobId { get; set; }

        /// <summary>
        /// 名称
        /// </summary>
        public string BoxName { get; set; }

        /// <summary>
        /// 规格
        /// </summary>
        public string MaterialSpec { get; set; }

        /// <summary>
        /// 货位名称
        /// </summary>
        public string LocalName { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public Double? StockNumber { get; set; }

        /// <summary>
        /// 时间
        /// </summary>
        public DateTime? CreateTime { get; set; }

    }

    /// <summary>
    /// 扫描单个物料信息
    /// </summary>
    public class AllocateMaterialDTO
    {

        /// <summary>
        /// 物料Id
        /// </summary>
        public string MaterialId { get; set; }

        /// <summary>
        /// 物料编号
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 物料规格
        /// </summary>
        public string Spec { get; set; }

        /// <summary>
        /// 调拨数量
        /// </summary>
        public Double? AllocateNum { get; set; }

    }

    /// <summary>
    /// 入库扫描混合包
    /// </summary>
    public class AllocatePackDetailMaterialDTO : TD_AllocatePackDetail
    {
        /// <summary>
        /// 单价
        /// </summary>
        public Double? Price { get; set; }

        /// <summary>
        /// 仓储单位Id
        /// </summary>
        public string storageId { get; set; }
    }

    /// <summary>
    /// 调拨出入库包的信息
    /// </summary>
    public class AllocatePackDTO
    {
        /// <summary>
        /// 包Id
        /// </summary>
        public string PackId { get; set; }

        /// <summary>
        /// 包二维码
        /// </summary>
        public string PackQrCode { get; set; }

        /// <summary>
        /// 包名称
        /// </summary>
        public string BoxName { get; set; }

        /// <summary>
        /// 包装数量
        /// </summary>
        public double? Nums { get; set; }

        public List<AllocatePackMaterialDetailDTO> AllocatePackMaterialDetail { get; set; }
    }

    /// <summary>
    /// 包明细(物料数量)
    /// </summary>
    public class AllocatePackMaterialDetailDTO
    {
        /// <summary>
        /// 包Id
        /// </summary>
        public string PackId { get; set; }
        /// <summary>
        /// 物料Id
        /// </summary>
        public string MaterialId { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string MaterialName { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料规格
        /// </summary>
        public string MaterialSpec { get; set; }

        /// <summary>
        /// 成品编码
        /// </summary>
        public string ProductCode { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public double? Nums { get; set; }

        /// <summary>
        /// 剩余数量(出：仓库剩余数量;入：调拨出库未入库的数量)
        /// </summary>
        public double? RemainingQuantity { get; set; }

    }

    /// <summary>
    /// 调拨单个成品输入数量
    /// </summary>
    public class AllocateJobMaterialDTO
    {
        /// <summary>
        /// 物料Id
        /// </summary>
        public string MaterialId { get; set; }

        /// <summary>
        /// 物料编码
        /// </summary>
        public string MaterialCode { get; set; }

        /// <summary>
        /// 物料名称
        /// </summary>
        public string MaterialName { get; set; }

        /// <summary>
        /// 物料规格
        /// </summary>
        public string MaterialSpec { get; set; }

        /// <summary>
        /// 包Id
        /// </summary>
        public string PackId { get; set; }

        /// <summary>
        /// 包二维码
        /// </summary>
        public string PackQrCode { get; set; }

        /// <summary>
        /// 数量
        /// </summary>
        public double? Nums { get; set; }

        /// <summary>
        /// 剩余数量(出：仓库剩余数量;入：调拨出库未入库的数量)
        /// </summary>
        public double? RemainingQuantity { get; set; }

    }

}